﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="ProcessOneProduct.aspx.cs" Inherits="WebCrawler.ProcessOneProduct" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
    $(document).ready(function () {

        var dataString = "";

        var prod = $(".CURRURL").text();
        prod = prod.trim();
        var dt = [];
        var dd = [];


        $("#Specs").each(function () {


            $("#Specs").find('dt').each(function () {
                dt.push($(this).text());
            });


            $("#Specs").find('dd').each(function () {
                dd.push($(this).text());
            });

        });



        var cats = [];
        $("#bcaBreadcrumbTop").find("dd").each(function () {
            cats.push($(this).text());
        });

        var items = [];
        $(".itemColumn").find("li").each(function () {
            items.push($(this).text());
        });

        var name = $('span[itemprop="name"]').html();

        for (var i = 0; i < dt.length; i++) {
            dataString += "[{" + dt[i] + "}~{" + dd[i] + "}]^";
        }




        //if (dataString) {

        dataString = Number(prod) + "%" + dataString;

        $.ajax({
            type: "POST",
            url: "ProcessOneProduct.aspx?dataString=" + dataString,
            data: dataString,
            cache: false,
            success: function (html) {
                $(".URLS").append("<br/>1:COMPLETED NUMCHARS: " + dataString.length + "<br/>DATA: " + dataString + "<br/>");
            }

        });


        dataString2 = "";

        for (var i = 0; i < cats.length; i++) {
            dataString2 += "[{Cats" + i + "}~{" + cats[i] + "}]^";
        }

        for (var i = 0; i < items.length; i++) {
            dataString2 += "[{Items" + i + "}~{" + items[i] + "}]^";
        }

        if (name) {
            dataString2 += "[{Name}~{" + name + "}]^";
        }


        dataString2 = Number(prod) + "%" + dataString2;

        $.ajax({
            type: "POST",
            url: "ProcessOneProduct.aspx?dataString=" + dataString2,
            data: dataString,
            cache: false,
            success: function (html) {
                $(".URLS").append("<br/>2:COMPLETED NUMCHARS: " + dataString2.length + "<br/>DATA: " + dataString2 + "<br/>");
            }

        });


        //}


        //document.write(dataString);

    });
    </script> 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   <asp:Timer ID="timer_Page" runat="server" Interval="12000" OnTick="GetNextPage">
    </asp:Timer>
</asp:Content>
